<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue</title>
</head>

<body>
    <div id="app">
        <button @click='show=true'>打开</button>
        <div class="mask" v-show='show'>
            <span @click='show=false'>×</span>
            <p>我是弹窗</p>
        </div>


        <ul>
            <li v-for='(item,index) in list' @click='activeIndex=index' :style="{color:activeIndex==index?'red':''}">{{item.title}}</li>
        </ul>
        <div>
            <p v-for='(item,index) in list[activeIndex].child'>{{item}}</p>
        </div>
    </div>
    <script src="./vue.js"></script>
    <script>
        const vue = new Vue({
            el: '#app',
            data: {
                show: false,
                activeIndex: 0,
                list: [{
                    title: '标题1',
                    child: ['杨旭', '情书', '王荣喜']
                }, {
                    title: '标题2',
                    child: ['账号借钱', '张浩杰', '一个亿']
                }, {
                    title: '标题3',
                    child: ['双十一', '依旧', '剁手']
                }, ]
            }
        });
    </script>
</body>

</html>